function myAlert(msg) {
	event.bubbles=false;
	box = document.getElementById('sbkAlert');
	if (box == null) {
		titre = '<div class="titre">Message d\'avertissement</div>';
		content = '<div class="content">'+msg+'</div>';
		boutons = '<div class="boutons"><input type="button" value="Ok" onclick="closeAlert()" /></div>';
		sbkAlert = '<div id="sbkAlert"><div id="box">'+titre+content+boutons+'</div></div>';
		document.body.innerHTML += sbkAlert;
	}
	else {
		box.children[0].children[1].innerHTML = msg;
		box.style.left = '0px';
	}
    
	//confirm('message intercepté :"'+msg+'"');
}

function closeAlert() {
	box = document.getElementById('sbkAlert');
	box.style.left = '-999em';
	return true
}

function addEvent(elem,event,func)
{
    var evn = "on"+event;
    elem[evn] = func;
}

addEvent(window, "load", function () {
	  var contactForm = document.getElementById("form1");
	  if (contactForm) {
	    addEvent(contactForm, "submit", function (evt) {
	      var firstName = document.getElementById("texteid");
	      var lastName = document.getElementById("dateid");
	      if (firstName && lastName) {
	        if (firstName.value.length === 0 || lastName.value.length === 0) {
	          myAlert('pwet');
	          evt.preventDefault();
	        }
	      }
	    });
	  }
	});

